using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFollow : MonoBehaviour
{

    Dave m_dave;

    [SerializeField]
    float m_altitude = 25;

    [SerializeField]
    float m_distance = 10;
   

    private void Start()
    {
        m_dave = FindObjectOfType<Dave>();
    }

    private void Update()
    {
        Vector3 calculPosition = m_dave.transform.position + (Vector3.forward * -m_distance) + (Vector3.up * m_altitude);
        transform.position = Vector3.Lerp(transform.position, calculPosition, 15 * Time.deltaTime);
        transform.LookAt(m_dave.transform);
    }
}
